/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.atencionemergencia.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "ubicacion_lesion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "UbicacionLesion.findAll", query = "SELECT u FROM UbicacionLesion u"),
    @NamedQuery(name = "UbicacionLesion.findByCodUbiLesion", query = "SELECT u FROM UbicacionLesion u WHERE u.codUbiLesion = :codUbiLesion"),
    @NamedQuery(name = "UbicacionLesion.findByDescUbiLesion", query = "SELECT u FROM UbicacionLesion u WHERE u.descUbiLesion = :descUbiLesion")})
public class UbicacionLesion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Ubi_Lesion", columnDefinition="CHAR(5) unsigned")
    private String codUbiLesion;
    @Column(name = "Desc_Ubi_Lesion")
    private String descUbiLesion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codUbiLesion")
    private Collection<Lesion> lesionCollection;

    public UbicacionLesion() {
    }

    public UbicacionLesion(String codUbiLesion) {
        this.codUbiLesion = codUbiLesion;
    }

    public String getCodUbiLesion() {
        return codUbiLesion;
    }

    public void setCodUbiLesion(String codUbiLesion) {
        this.codUbiLesion = codUbiLesion;
    }

    public String getDescUbiLesion() {
        return descUbiLesion;
    }

    public void setDescUbiLesion(String descUbiLesion) {
        this.descUbiLesion = descUbiLesion;
    }

    @XmlTransient
    public Collection<Lesion> getLesionCollection() {
        return lesionCollection;
    }

    public void setLesionCollection(Collection<Lesion> lesionCollection) {
        this.lesionCollection = lesionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codUbiLesion != null ? codUbiLesion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UbicacionLesion)) {
            return false;
        }
        UbicacionLesion other = (UbicacionLesion) object;
        if ((this.codUbiLesion == null && other.codUbiLesion != null) || (this.codUbiLesion != null && !this.codUbiLesion.equals(other.codUbiLesion))) {
            return false;
        }
        return true;
    }
    
}
